<?php

class Agent_PropertyController extends Zend_Controller_Action
{
	public function init()
	{
		$authData = Zend_Auth::getInstance()->getStorage()->read();
		if (is_array($authData) and $authData['identity'] != 'anon' and strtolower($authData['userType']) == 'agnt'){
			$_SESSION['agent_reg_id'] = $authData['identity']; 
        }
	}
	
	public function indexAction()
	{
		
	}
	
	public function uploadAction()
	{
		
	}
	
	public function viewAction()
	{
		$agnt = new Reale_Model_Users_Agent();
		$agnt->setAgent_reg_id($_SESSION['agent_reg_id']);
		$prop = new Reale_Model_Estate_Property();
		$prop->setReferer($agnt->getAgent_id());
		$result = $prop->fetch();
		if(!$result){
		 	
		 	$this->view->assign('msg',' ! Sorry: No property has been uploaded by you.');
		 }
		 else{
		  	$this->view->assign('property',$result);
		 }
	}
}